docs(examples): add security scanning utilities example#1
Open
vincent067 wants to merge 3 commits intomainfrom
Open
docs(examples): add security scanning utilities example#1vincent067 wants to merge 3 commits intomainfrom
vincent067 wants to merge 3 commits intomainfrom
Conversation
Add examples/ directory with 4 common use cases: - build-script.js: Build automation with error handling - git-helpers.js: Git operation wrappers - parallel-tasks.js: Running commands in parallel - stream-processing.js: Output filtering with transforms All examples use ES modules and are self-contained.
Add comprehensive documentation for Windows-specific fixes: - PATHEXT support explanation with examples - How Windows execution works under the hood - Comparison table: automatic fixes vs shell mode - Detailed breakdown of node-cross-spawn fixes - Best practices for choosing between default mode and shell mode Fixes sindresorhus#997
Add a new example demonstrating security scanning use cases with execa: - npm audit integration for dependency vulnerability scanning - semgrep integration for static analysis security testing - gitleaks integration for secret detection in git history - Comprehensive security report generation This example shows how to: - Handle JSON output from security tools - Process exit codes (security tools often exit non-zero when issues found) - Gracefully handle missing tools with helpful error messages - Aggregate results from multiple security scans The example follows the same patterns as other examples in the directory and includes proper error handling, ES module syntax, and can be run directly or imported as a module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey there! 👋
I've been using execa in my security automation workflows and noticed the examples directory doesn't have any security-focused examples. Thought I'd contribute one that might help other developers integrating security tools into their Node.js scripts.
This example shows how to use execa with popular security scanning tools:
The tricky part with security tools is they often exit with non-zero codes when they find issues (which is actually the success case for security scanning). The example shows how to handle this properly by checking
error.stdoutand parsing the results.Happy to make any adjustments based on feedback! 😊